class MOVEASSIST extends eui.Component implements  eui.UIComponent {
	leftbutton:eui.Button
	upbutton:eui.Button
	fistpos:egret.Point=new egret.Point
	movel:boolean=false
	moveu:boolean=false
	public constructor() {
		super();
	}

	protected partAdded(partName:string,instance:any):void
	{
		super.partAdded(partName,instance);
	}


	protected childrenCreated():void
	{
		super.childrenCreated();
		this.leftbutton.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.moveleft,this);
		this.leftbutton.addEventListener(egret.TouchEvent.TOUCH_MOVE,this.moveleft,this);
		this.upbutton.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.moveup,this);
		this.upbutton.addEventListener(egret.TouchEvent.TOUCH_MOVE,this.moveup,this);
	}
	private moveleft(e:egret.TouchEvent)
	{
       if(e.type==egret.TouchEvent.TOUCH_BEGIN)
	   {
		 this.movel=true
		 this.moveu=false
         this.fistpos.x=e.stageX
		 this.fistpos.y=e.stageY
	   }
	   else 
	   {
		   if(CMainEditor.editor.goal!=undefined&&this.movel)
		   {
             let offsetx=this.fistpos.x-e.stageX
		     this.x-=offsetx
		     CMainEditor.editor.goal.x-=offsetx
		     this.fistpos.x=e.stageX
		   }
	   }
	}
	private moveup(e:egret.TouchEvent)
	{
        if(e.type==egret.TouchEvent.TOUCH_BEGIN)
	   {
		   this.movel=false
		 this.moveu=true
         this.fistpos.x=e.stageX
		 this.fistpos.y=e.stageY
	   }
	   else 
	   {
		    if(CMainEditor.editor.goal!=undefined&&this.moveu)
		   {
             let offsety=this.fistpos.y-e.stageY
		     this.y-=offsety
		     CMainEditor.editor.goal.y-=offsety
		     this.fistpos.y=e.stageY
		   }
	   }
	}
	public get offsetxy():egret.Point
	{
        let a=new egret.Point(this.upbutton.width,this.leftbutton.height)
		return a
	}
	
}